package com.gwl.circle.api.controller;

import com.gwl.circle.api.provider.UserProvider;
import com.gwl.circle.common.bo.UserAddBo;
import com.gwl.circle.common.bo.UserLoginBo;
import com.gwl.circle.common.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author 高万里
 */

@RestController
@RequestMapping("/api/user/")
@Api(tags = "用户操作")
public class UserController {

    @Resource
    private UserProvider provider;

    @ApiModelProperty("注册")
    @PostMapping("register")
    public R register(@RequestBody UserAddBo bo){
        return provider.register(bo);
    }

    @ApiModelProperty("登录")
    @PostMapping("login")
    public R login(@RequestBody UserLoginBo bo) {
        return provider.login(bo);
    }

    @ApiModelProperty("查询所有")
    @GetMapping("all")
    public R all(){
        return provider.all();
    }

    @ApiModelProperty("根据token查询成长记录")
    @GetMapping("growthRecord")
    public R growthRecord(){
        return provider.growthRecord();
    }

    @ApiModelProperty("退出登录")
    @GetMapping("logout")
    public R logout(){
        return provider.logout();
    }
}
